#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, m;
	cin>>n>>m;
	unordered_map<int, int> mp;
	while(n--)
	{
		string a;
		cin>>a;
		for(int i = 0;i < m;i++)
		{
			int t = (int)(a[i]-'0');
			if(!mp.count(i))
				mp[i] = t;
			else if(mp[i]%10 < t)
				mp[i] = t;
			else if(mp[i]%10 == t)
				mp[i] = 10+t;
		}
	}
	int ans = 0;
	for(auto i = mp.begin();i != mp.end();i++)
		if(i->second < 10)
			ans++;
	cout<<ans;
	return 0;
}

